package com.qf.controller;


import com.qf.bean.AjaxMessage;
import com.qf.entity.Lesson;
import com.qf.service.ILessonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lcx
 * @since 2020-09-03
 */
@RestController
@RequestMapping("/class")
public class LessonController {
    @Autowired
    ILessonService lessonService;

    @RequestMapping("/free")
    public AjaxMessage select(Lesson lesson){
        List<Lesson> lessons = lessonService.selectBy(lesson);
        if (lessons != null && lessons.size() !=0){

            return new AjaxMessage(0,"",lessons);
        }
        return new AjaxMessage(1,"查询失败");
    }
    @RequestMapping("/begin")
    public AjaxMessage selectLesson(Lesson lesson){
        List<Lesson> lessons = lessonService.selectBy(lesson);
        if (lessons != null && lessons.size() !=0){

            return new AjaxMessage(0,"",lessons);
        }
        return new AjaxMessage(1,"查询失败");
    }
    @RequestMapping("/back")
    public AjaxMessage selectClass(Lesson lesson){
        List<Lesson> lessons = lessonService.selectBy(lesson);
        if (lessons != null && lessons.size() !=0){

            return new AjaxMessage(0,"",lessons);
        }
        return new AjaxMessage(1,"查询失败");
    }

}
